/*
 * app_parameters.h
 *
 *  Created on: 2021��2��2��
 *      Author: Victory
 */

#ifndef SRC_APP_APP_PARAMETERS_H_
#define SRC_APP_APP_PARAMETERS_H_

/******************************************************************************/
/***************************** Include Files **********************************/
/******************************************************************************/
#include "app_config.h"
#include "xparameters.h"

/******************************************************************************/
/********************** Macros and Constants Definitions **********************/
/******************************************************************************/

#define GPIO_DEVICE_ID		XPAR_PS7_GPIO_0_DEVICE_ID

//SPI CS
#define CLK9528_CS			0
#define ADRV9009_CS			1

//XC7Z100 GPIO
#define GPIO_OFFSET			54

#define ADRV9009_RESETB		54 + 0
#define ADRV9009_TEST		54 + 9
#define AD9528_RESETB		54 + 13
#define AD9528_SYSREF_REQ	54 + 14

#define TX_DATA_OFFSET		(0 << 2)		//tx_data
#define TX_STATUS0_OFFSET	(1 << 2)		//tx_status0
#define TX_CARRIER_DATA   	(2 << 2)		//tx_carrier
#define TX_CTRL_OFFSET   	(3 << 2)		//bit0:start; bit1:stop
#define TX_CTRL1_OFFSET		(4 << 2)		//tx ctrl inter lenth
#define TX_STATUS1_OFFSET	(5 << 2)		//tx_status1
#define TX_STATUS2_OFFSET	(6 << 2)		//tx_status2

#define RX_DATA_OFFSET		(0 << 2)		//rx_data
#define RX_STATUS_OFFSET	(1 << 2)		//rx_status
#define RX_CTRL0_OFFSET		(3 << 2)		//rx_ctrl0
#define RX_CTRL1_OFFSET		(4 << 2)		//rx_ctrl1

#define DATA_SOURCE_ADDR	(0)
#define JESD_CTRL_ADDR		(4)
#define DATA_CONSTANT_ADDR	(8)
#define FH_select_vector_ADDR	(12)


#define setbit(x,y)  x |= (1 << y)
#define clrbit(x,y)  x &= ~(1 << y)

#define PHY0_JESD_BASEADDR		XPAR_JESD204_PHY_0_BASEADDR
#define PHY1_JESD_BASEADDR		XPAR_JESD204_PHY_1_BASEADDR
#define AXI_SIGNAL_0_BASEADDR		XPAR_AXI_SIGNAL_0_BASEADDR

#define RX_JESD_BASEADDR		XPAR_JESD204_1_BASEADDR
#define TX_JESD_BASEADDR		XPAR_JESD204_2_BASEADDR
#define RX_OS_JESD_BASEADDR		XPAR_JESD204_0_BASEADDR

#define DDR_MEM_BASEADDR		XPAR_DDR_MEM_BASEADDR
#define ADC_DDR_BASEADDR		XPAR_DDR_MEM_BASEADDR + 0x800000
#define DAC_DDR_BASEADDR		XPAR_DDR_MEM_BASEADDR + 0xA000000

#define UART_DEVICE_ID			XPAR_XUARTPS_0_DEVICE_ID
#define UART_IRQ_ID				XPAR_XUARTPS_1_INTR
#define INTC_DEVICE_ID			XPAR_SCUGIC_SINGLE_DEVICE_ID


#endif /* SRC_APP_APP_PARAMETERS_H_ */
